-
-
Notifications
You must be signed in to change notification settings - Fork 363
feat(OpcDa): add Browse feature #6565
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Reviewer's GuideThis PR extends the OPC DA sample with a new Browse feature by adding server-side browsing methods to retrieve and map nodes to TreeViewItems, and updating the Razor UI to include a Browse button and TreeView display. File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @ArgoZhang - I've reviewed your changes - here's some feedback:
- The C# initializer
_roots = []isn’t valid—usenew List<TreeViewItem<OpcBrowseElement>>()ornew()instead. - Wrapping your Bootstrap grid in a
<p>is semantically incorrect—use<div class="row g-3">and matching<div>tags instead of<p>.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The C# initializer `_roots = []` isn’t valid—use `new List<TreeViewItem<OpcBrowseElement>>()` or `new()` instead.
- Wrapping your Bootstrap grid in a `<p>` is semantically incorrect—use `<div class="row g-3">` and matching `<div>` tags instead of `<p>`.
## Individual Comments
### Comment 1
<location> `src/BootstrapBlazor.Server/Components/Samples/OpcDa.razor.cs:108` </location>
<code_context>
+ HasChildren = i.HasChildren,
+ Icon = i.HasChildren ? "fa-solid fa-fw fa-cube" : "fa-solid fa-fw fa-wrench"
+ });
+ if (!items.Any())
+ {
+ element.HasChildren = false;
+ }
+ return Task.FromResult(items);
</code_context>
<issue_to_address>
Directly mutating element.HasChildren may cause UI inconsistencies.
This mutation may not trigger a UI update if the TreeView relies on its own state. Consider letting the TreeView infer child presence from the returned items instead.
</issue_to_address>
### Comment 2
<location> `src/BootstrapBlazor.Server/Components/Samples/OpcDa.razor:45` </location>
<code_context>
<p class="code-label">3. 订阅功能</p>
<p>通过订阅可以监控一组 <b>位号</b> 数据改变情况,当数据改变时通过 <code>DataChanged</code> 回调方法通知订阅者</p>
- <div class="row g-3">
+ <p class="row g-3">
<div class="col-12 col-sm-6">
<BootstrapInputGroup>
</code_context>
<issue_to_address>
Using <p> as a container for form controls may not be semantically correct.
Consider replacing the <p> tag with a <div> or another suitable container to ensure valid HTML and proper rendering.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| if (!items.Any()) | ||
| { | ||
| element.HasChildren = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question (bug_risk): Directly mutating element.HasChildren may cause UI inconsistencies.
This mutation may not trigger a UI update if the TreeView relies on its own state. Consider letting the TreeView infer child presence from the returned items instead.
| <Button OnClick="OnCreateSubscription" Text="订阅" IsDisabled="@(!OpcDaServer.IsConnected || _subscribed)"></Button> | ||
| <Button OnClick="OnCancelSubscription" Text="取消" IsDisabled="!_subscribed"></Button> | ||
| </div> | ||
| </div> | ||
| </p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: Using
as a container for form controls may not be semantically correct.
Consider replacing the
tag with a
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6565 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 719 719
Lines 31560 31560
Branches 4450 4450
=========================================
Hits 31560 31560
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Link issues
fixes #6564
Summary By Copilot
Regression?
Risk
Verification
Packaging changes reviewed?
☑️ Self Check before Merge
Summary by Sourcery
Add a hierarchical browsing feature to the OPC DA sample by querying the server for nodes and rendering them in a TreeView with expand-on-demand.
New Features: